* Stata .do file for Nizan Feldman and Mark Shiptan  "Naval Power, Merchant Fleets and the Impact of Conflict on Trade"
*  Security Studies
* Please send any questions or comments to nfeldman@poli.haifa.ac.il

*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*** Replication Code for Tables and Graphs in the Main Text and Appendix
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

sort IM_EX ccode1 ccode2 year

xtset dyadid year
 

***Table 1: Third-party Trade, Conflict, Naval Power, and Merchant Fleets***

* Model l
xtreg  Directed_trade_flow   c.l.Importer_Merchant_Fleet##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model 2
xtreg  Directed_trade_flow   c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model 3
xtreg  Directed_trade_flow   c.l.Exporter_Merchant_Fleet##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model 4
xtreg  Directed_trade_flow   c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

***Table 2: Naval Power and CINC***

* Model 5
xtreg  Directed_trade_flow   c.l.ln_cinc_11##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model 6
xtreg  Directed_trade_flow   c.l.ln_cinc_22##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model 7
xtreg  Directed_trade_flow   c.l.ln_cinc_11##c.l.Third_Party_Conflict_I c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model 8
xtreg  Directed_trade_flow   c.l.ln_cinc_22##c.l.Third_Party_Conflict_E c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)


*** Table A1. Using Gibler-Miller-Little MID data***

* Model A1-1
xtreg  Directed_trade_flow   c.l.Importer_Merchant_Fleet##c.l.Third_Party_Conflict_I_GLM l.Dyadic_Conflict_100_GML Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A1-2

xtreg  Directed_trade_flow   c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I_GLM l.Dyadic_Conflict_100_GML Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A1-3

xtreg  Directed_trade_flow   c.l.Exporter_Merchant_Fleet##c.l.Third_Party_Conflict_E_GLM l.Dyadic_Conflict_100_GML Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A1-4

xtreg  Directed_trade_flow   c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E_GLM l.Dyadic_Conflict_100_GML Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)


*** Table A2. Including all Fatal MIDs***

* Model A2-5
xtreg  Directed_trade_flow   c.l.Importer_Merchant_Fleet##c.l.Third_Party_Conflict_I_F l.Dyadic_Conflict_F Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A2-6
xtreg  Directed_trade_flow   c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I_F l.Dyadic_Conflict_F Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A2-7
xtreg  Directed_trade_flow   c.l.Exporter_Merchant_Fleet##c.l.Third_Party_Conflict_E_F l.Dyadic_Conflict_F Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A2-8
xtreg  Directed_trade_flow c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E_F l.Dyadic_Conflict_F Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)


*** Table A3. Using an Ordinal DV***

* Model A3-9
xtreg  Directed_trade_flow   c.l.Importer_Merchant_Fleet##c.l.Third_Party_Conflict_I_O l.Dyadic_Conflict_O Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A3-10
xtreg  Directed_trade_flow   c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I_O l.Dyadic_Conflict_O Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A2-11
xtreg  Directed_trade_flow   c.l.Exporter_Merchant_Fleet##c.l.Third_Party_Conflict_E_O l.Dyadic_Conflict_O Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A2-12
xtreg  Directed_trade_flow c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E_O l.Dyadic_Conflict_O Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)


*** Table A4. Dyadic Specification for third-Party conflict***

* Model A4-13
xtreg  Directed_trade_flow   c.l.Combatant_Merchant_Fleet##c.l.Third_Party_Conflict_ND l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)

* Model A4-14
xtreg  Directed_trade_flow   c.l.Combatant_Naval_Power##c.l.Third_Party_Conflict_ND l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)


*** Table A5. High-Dimensional Fixed Effects***
* In order to reproduce our results your STATA package must have the reghdfe command with the two-way clustering option for the errors. 

* Model A5-15
reghdfe  Directed_trade_flow c.l.Importer_Merchant_Fleet##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy ,  absorb( EXPORTER_YEAR22 dyadid ) vce(cluster  year dyadid)

* Model A5-16
reghdfe  Directed_trade_flow c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy ,  absorb( EXPORTER_YEAR22 dyadid ) vce(cluster  year dyadid)

* Model A5-17
reghdfe  Directed_trade_flow c.l.Exporter_Merchant_Fleet##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy ,  absorb( IMPORTER_YEAR11 dyadid ) vce(cluster  year dyadid)

* Model A5-18
reghdfe  Directed_trade_flow c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy ,  absorb( IMPORTER_YEAR11 dyadid ) vce(cluster  year dyadid)


*** Table A6. 3-way Interaction**

* Model A6_19
xtreg  Directed_trade_flow   c.l.Importer_Merchant_Fleet##c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)


* Model A6_20
xtreg  Directed_trade_flow   c.l.Exporter_Merchant_Fleet##c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)


*** Figure 3
*(from Model 1)
xtreg  Directed_trade_flow   c.l.Importer_Merchant_Fleet##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)
margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Merchant_Fleet= (5(1)19))
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Merchent Fleet") ytitle("Marginal effect of Third-Party Conflict") title(3) addplot (hist Importer_Merchant_Fleet, color(gs14) yaxis(2))

*** Figure 4
*(from Model 2)
xtreg  Directed_trade_flow   c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)
margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Naval_Power= (0(1)16))
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Naval Power") ytitle("Marginal effect of Third-Party Conflict") title(4) addplot (hist Importer_Naval_Power, color(gs14) yaxis(2))

*** Figure 5
*(from Model 3)
xtreg  Directed_trade_flow c.l.Exporter_Merchant_Fleet##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)
margins, dydx(l.Third_Party_Conflict_E) at( l.Exporter_Merchant_Fleet= (5(1)19))
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Exporter's Merchent Fleet") ytitle("Marginal effect of Third-Party Conflict") title(5) addplot (hist Exporter_Merchant_Fleet, color(gs14) yaxis(2))

*** Figure 6
*(from Model 4)
xtreg  Directed_trade_flow   c.l.Exporter_Naval_Power##c.l.Third_Party_Conflict_E l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)
margins, dydx(l.Third_Party_Conflict_E) at( l.Exporter_Naval_Power= (0(1)16))
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Exporter's Naval Power") ytitle("Marginal effect of Third-Party Conflict") title(6)   addplot (hist Exporter_Naval_Power, color(gs14) yaxis(2))


*** Figure 7

*** Figure 7 left-hand graph
***from (Model A6_19)

xtreg  Directed_trade_flow   c.l.Importer_Merchant_Fleet##c.l.Importer_Naval_Power##c.l.Third_Party_Conflict_I l.Dyadic_Conflict_100 Importre_GDP Importres_GDP_per_capita Exportre_GDP Exportres_GDP_per_capita Currency PTA WTO2 Ally Joint_Democracy i.year , fe cl(dyadid)
margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Merchant_Fleet= (5(1)19) l.Importer_Naval_Power==8.2 )
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Merchent Fleet") ytitle("Marginal effect of Third-Party Conflict") title(Naval Power at One Standart Deviation Below the Mean) 

*** Figure 7, middle graph
margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Merchant_Fleet= (5(1)19) l.Importer_Naval_Power==10.04 )
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Merchent Fleet") ytitle("Marginal effect of Third-Party Conflict") title(Naval Power at its Mean)

*** Figure 7, right-hand graph
margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Merchant_Fleet= (5(1)19) l.Importer_Naval_Power==11.85 )
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Merchent Fleet") ytitle("Marginal effect of Third-Party Conflict") title(Naval Power at One Standart Deviation Above the Mean)
 

*** Figure 8
***from (Model A6_19)

*** Figure 8 left-hand graph

margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Naval_Power= (0(1)16) l.Importer_Merchant_Fleet==9.6 )
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Naval Power") ytitle("Marginal effect of Third-Party Conflict") title( Merchent Fleet at One Standart Deviation Below the Mean)

*** Figure 8 middle graph
margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Naval_Power= (0(1)16) l.Importer_Merchant_Fleet==12.55 )
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Naval Power") ytitle("Marginal effect of Third-Party Conflict") title( Merchent Fleet at its Mean)

*** Figure 8 middle graph
margins, dydx(l.Third_Party_Conflict_I) at( l.Importer_Naval_Power= (0(1)16) l.Importer_Merchant_Fleet==15.45 )
marginsplot, recast(line)   plotopts(lcolor(black)) recastci(rline) ciopts(lcolor(black) lpattern(dash)) yline(0) xtitle("Importer's Naval Power") ytitle("Marginal effect of Third-Party Conflict") title( Merchent Fleet at One Standart Deviation Above the Mean)
